home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Adult Reference Library 1.a
/
The Adult Reference Library Volume 1.a.iso
/
go-menu.inf
< prev
next >
Wrap
Text File
|
1993-02-12
|
10KB
|
257 lines
╔════════════════════╗
║ ║
║ WHAT IS GO-MENU? ║
║ ║
╚════════════════════╝
The GO-MENU program is used in a batch file to present a menu of up to 10
items. It's ideal for:
■ Organizing your batch files
■ Setting up a DOS shell (with an unlimited number of menus!)
■ Laying out a "magazine-on-disk"
■ Integrating your software product's various programs
■ Arranging online documentation in a convenient way
The menus options can be selected by:
■ Arrow keys and Enter
■ Mouse and Left Button
■ Function key
GO-MENU uses DOS ERRORLEVEL (explain later) to report:
■ Menu option selected (1 to 10)
■ Esc (or Mouse Right Button)
╔══════════════════════╗
║ ║
║ HOW TO USE GO-MENU ║
║ ║
╚══════════════════════╝
╒═══════════════╕
│ QUICK-START │
╘═══════════════╛
If you are already familiar with:
■ Text editors
■ Batch files
■ The IF ERRORLEVEL batch statement
you can learn most of what you need to know by entering the following two
commands at the DOS prompt:
■ GO-MENU /?
■ SEE START.MNU
A more detailed explanation of GO-MENU follows.
╒════════════════════════════╕
│ THE MENU DEFINITION FILE │
╘════════════════════════════╛
GO-MENU reads the contents of the menu from an ordinary text file that you
have prepared with a text editor (e.g. DOS's EDLIN or EDIT, or a programmer's
editor, or a word processor in "DOS Text" mode). The text file contains
eleven lines, corresponding to:
■ The menu title
■ The F1, F2, F3 ... F10 lines on the menu.
The basic DOS command line format for GO-MENU is:
GO-MENU <menu file>
For example, at the DOS prompt, you could enter the command as:
GO-MENU START.MNU
The file START.MNU (included with "The SEE Utilities") contains the menu
for the batch file START.BAT. It shows also how lines beginning with a
semi-colon (;) are ignored as comments. To view START.MNU, enter the
following command at the DOS prompt:
SEE START.MNU
The menu file does not have to have a MNU extension, but for the sake of
clarity, it is a good idea to give all your menus the same extension.
If you have less than 10 items on your menu, you can leave some lines blank.
These lines will then be left blank on the menu when it is displayed.
NOTE: If there are more than one blank line in a row, only one blank line
will be shown. For example, if you had a menu definition file like this:
┌───────────────────────────┐
│; This is a comment line │ <-- Comment line (not displayed)
│My Sample Menu │ <-- Menu title
│This is the 1st menu line │ <-- Corresponds to F 1 key
│ │ <-- Blank line to skip F 2 key
│This is the 3rd menu line │ <-- Corresponds to F 3 key
│ │ <-- Blank line to skip F 4 key
│ │ <-- Blank line to skip F 5 key
│This is the 6th menu line │ <-- For F 6 key
│ │ <-- Blank line to skip F 7 key
│This is the 8th menu line │ <-- For F 8 key
│This is the 9th menu line │ <-- For F 9 key
│This is the 10th menu line │ <-- For F10 key (should be used for Quit)
└───────────────────────────┘
there would only be ONE blank line between F3 and F6, even though both F4
and F5 have been left blank. This results in a more attractive menu.
The menu file shown above has been included with "The SEE Utilities". If
you would like to try it out, enter the following command at the DOS prompt:
GO-MENU MYMENU.MNU
If you want to look at the menu definition file MYMENU.MNU, enter this
command at the DOS prompt:
SEE MYMENU.MNU
For reasons that will be explained later, it is best to define the F10 key
as "Quit" (i.e. return to previous menu or operation).
When GO-MENU is looking for a menu file, it will look in the CURRENT drive
and directory first. If it can not find it there, it will look in the
directory that GO-MENU.EXE itself is in. You can override this behaviour by
specifying the full DOS path name to the file. (e.g. C:\MYMENUS\MENUX.MNU)
╒══════════════════╕
│ THE BATCH FILE │
╘══════════════════╛
GO-MENU controls a batch file by setting the DOS ERRORLEVEL. (For complete
information about coding batch files, you can refer to your DOS manual,
though there is enough information given here to code batch files that use
GO-MENU.)
A batch file is an ordinary text file that you have prepared with a text
editor (e.g. DOS's EDLIN or EDIT, or a programmer's editor, or a word
processor in "DOS Text" mode). A batch file MUST have a BAT extension for
DOS to recognize it. Thus, the name MYBATCH.BAT is a valid batch file name,
while MYBATCH.TXT is not.
Let us say you are using the menu definition file MYMENU.MNU (described in
the previous section). You would code your batch file like this:
┌─────────────────────────────────────┐
│ECHO OFF │ <-- Don't echo commands
│:AGAIN │ <-- A batch label (used by GOTO)
│GO-MENU MYMENU.MNU │ <-- Call the GO-MENU program
│IF ERRORLEVEL 10 GOTO QUIT │ <-- Check for F10 key
│IF ERRORLEVEL 9 GOTO F9 │ <-- Check for F 9 key
│IF ERRORLEVEL 8 GOTO F8 │ <-- Check for F 8 key
│IF ERRORLEVEL 6 GOTO F6 │ <-- Check for F 6 key
│IF ERRORLEVEL 3 GOTO F3 │ <-- Check for F 3 key
│IF ERRORLEVEL 1 GOTO F1 │ <-- Check for F 1 key
│:F9 │ <-- A batch label (used by GOTO)
│ECHO That was F9 │ <-- Displays the text on the screen
│GOTO WAIT │ <-- Jumps ahead to the :WAIT label
│ ■ │
│ ■────Similar code for F8, F6, etc. │
│ ■ │
│:WAIT │ <-- A batch label (used by GOTO)
│PAUSE │ <-- Waits for user to press a key
│GOTO AGAIN │ <-- Jumps back to the :AGAIN label
│:QUIT │ <-- A batch label (used by GOTO)
└─────────────────────────────────────┘
The complete batch file shown above is included with "The SEE Utilities".
It is named MYMENU.BAT. To try it out, enter the following command at the
DOS prompt:
MYMENU
▒▒▒ IMPORTANT NOTE: When you write your batch file, you must be sure
▒█▒ to test the highest ERRORLEVELs first, because IF ERRORLEVEL is
▒▒▒ considered "TRUE" if the ERRORLEVEL is the indicated number OR HIGHER.
╒════════════════╕
│ STICKY MENUS │
╘════════════════╛
If you tried out the MYMENU.BAT file (described in the last section), you
probably noticed that after each selection, the selection bar returned to
the first item. This is fine for simple applications, but if you have a lot
of menus, it would be nice to have it remember which item you selected on
each menu.
GO-MENU can create a "save" file that remembers where each menu is pointed.
To create a save file, start up GO-MENU with this command format:
GO-MENU <menu file name> <save number> <save file name>
For example, to use the menu file MYMENU.MNU and save the menu position as
"Menu Number 1" in the save file MENU.SAV, you would enter the command this
way:
GO-MENU MYMENU.MNU 1 MENU.SAV
After you've done that, every time you call up GO-MENU with that command
line, it will remember which option was last selected on the menu MYMENU.MNU.
A sample batch file that uses this technique can be found in MENUSAVE.BAT.
To try it out, enter the following command at the DOS prompt:
MENUSAVE
▒▒▒ IMPORTANT NOTE: When you save a menu position, you are writing to the
▒█▒ disk. For this reason, a save file will not work properly if it is
▒▒▒ used on a diskette that is write-protected.
The save procedure will save any selection EXCEPT F10. This is because F10
is reserved, by GO-MENU, for "Quit". (If "Quit" was saved, most of the
menus you save would remember that as the last option selected!)
A save file can save up to 256 menus, numbered from 0 to 255. If you need
more menus than that, you can use a different save file. It helps to keep
track of the save numbers you have used by noting them in comment lines in
the main menu. (For an example of this, SEE the file START.MNU)
▒▒▒ IMPORTANT NOTE: Remember that the save file is CREATED the first time
▒█▒ it is used. If you are putting GO-MENU on a diskette, it's a good idea
▒▒▒ to create the save file ahead of time, so you don't run out of space.
When GO-MENU is looking for a menu file, it will look in the CURRENT drive
and directory first. You can override this behaviour by specifying the full
DOS path name to the file. (e.g. C:\MYMENUS\MENUX.SAV)
╔═══════════════════════╗
║ ║
║ MISCELLANEOUS NOTES ║
║ ║
╚═══════════════════════╝
For a quick summary of the material covered above, try starting GO-MENU by
typing the following command at the DOS prompt:
GO-MENU /?
If you would like to see a major application that uses GO-MENU and SEE for
integration, we recommend that you obtain an evaluation copy of the Sapphire
BBS software from us. See the file AMAZE.DOC for details.